import { Logger } from './log'

export function safeParse<T>(str: string) {
  if (!str) return {}
  let obj = {} as T
  try {
    obj = JSON.parse(str) as T
  } catch (err) {
    Logger.warn('parse解析json字符错误', err)
  }
  return obj
}
